<template>
  <div class="common-layout">
    <el-container>
      <el-header>
        <div class="top" v-if="!store.state.token">
          <p>专栏</p>
          <div>
            <el-button type="primary" @click="$router.push('/Login')">登录</el-button>
            <el-button>注册</el-button>
          </div>
        </div>
        <div class="top" v-else>
          <p>专栏</p>
          <div>
            <el-dropdown trigger="click">
              <el-button type="primary">
                {{ store.state.nickName }}<el-icon class="el-icon--right"><arrow-down /></el-icon>
              </el-button>
              <template #dropdown>
                <el-dropdown-menu>
                  <el-dropdown-item @click="$router.push('/create')">新建文章</el-dropdown-item>
                  <el-dropdown-item @click="gozlgoods">我的专栏</el-dropdown-item>
                  <el-dropdown-item>编辑资料</el-dropdown-item>
                  <el-dropdown-item @click="reun">退出登录</el-dropdown-item>
                </el-dropdown-menu>
              </template>
            </el-dropdown>
          </div>
        </div>
      </el-header>
      <el-main> <router-view /></el-main>
    </el-container>
  </div>
</template>
<script lang="ts"  setup>
import {
  ArrowDown,
  Check,
  CircleCheck,
  CirclePlus,
  CirclePlusFilled,
  Plus,
} from '@element-plus/icons-vue'
import { ref, reactive, toRefs } from 'vue'
import { useStore } from 'vuex'
import { useRouter, useRoute } from 'vue-router'
const router = useRouter()
const route = useRoute()
const store = useStore()
const data=reactive({})
const id=store.state.column
const reun=()=>{
  store.commit("reun")
  router.push("/login")
}
// 跳转页面
const gozlgoods=async()=>{
 await router.push("/zlgoods")
}
</script>

<style lang="scss" scoped>
.el-header {
  width: 100%;
  background-color: blue;
  color: #fff;

  .top {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
}

.el-main {
  width: 100%;
  height: 90%;
}
</style>
